/*
 * Copyright 2020-2021 the original author or authors.
 *
 * Licensed under the General Public License, Version 3.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.gnu.org/licenses/gpl-3.0.en.html
 */

package team.seekers.oj.group.api;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;
import team.seekers.oj.common.entity.ApiResponseBody;
import team.seekers.oj.common.exception.InternalApiException;
import team.seekers.oj.common.util.RedisConstants;
import team.seekers.oj.user.dto.UserDTO;

import java.util.List;
import java.util.Map;

/**
 * @InterfaceName GroupApi
 * @Description 用户分组应用内部接口
 * @Author hbc
 * @Date 2022/1/20 10:23
 * @Version V1.0
 **/

@RequestMapping("/internal/group")
public interface GroupApi {
    String SERVICE_NAME = "user-service";

    /**
     * 根据groupId查询userId集合
     * @param groupId
     */
    @GetMapping("/groupIdToUserIds")
    @Cacheable(key = "#groupId", value = RedisConstants.GROUP_ID_TO_USER_IDS)
    List<Long> groupIdToUserIds(@RequestParam("groupId") Long groupId);

    /**
     * @Description 新增群组参加比赛
     * @param groupId
     * @param contestId
     **/
    @GetMapping("/addGroupParticipateContest")
    void addGroupParticipateContest(@RequestParam("groupId")long groupId, @RequestParam("contestId")long contestId);

    /**
     * @Description 群组新增作业
     * @param groupId
     * @param homeworkId
     **/
    @GetMapping("/addGroupParticipateHomework")
    void addGroupParticipateHomework(@RequestParam("groupId")long groupId,
                                            @RequestParam("homeworkId")long homeworkId);

    /**
     * @Description 群组新增课程
     * @param groupId
     * @param courseId
     **/
    @GetMapping("/addGroupParticipateCourse")
    void addGroupParticipateCourse(@RequestParam("groupId")long groupId,
                                     @RequestParam("courseId")long courseId);


    /**
     * @Description 查询群组绑定的课程
     **/
    @GetMapping("/queryParticipateCourse")
    List<Long> queryParticipateCourse(@RequestParam("groupId") long groupId);



    /**
     * @Description 查询群组参加过的比赛
     **/
    @GetMapping("/queryParticipateContest")
    List<Long> queryParticipateContest(@RequestParam("groupId") long groupId);

    /**
     * @Description 查询群组绑定的作业
     **/
    @GetMapping("/queryParticipateHomework")
    List<Long> queryParticipateHomework(@RequestParam("groupId") long groupId);

}
